readAt

open override fun readAt(position: Long, length: Int): ByteArray(source)

Read bytes from the specified position.

Return

ByteArray of exactly length bytes

Parameters

position

Starting byte offset (0-indexed)

length

Number of bytes to read

Throws

if position + length > size

IOException

on read failure


open override fun readAt(position: Long, buffer: ByteArray, offset: Int, length: Int): Int(source)

Read bytes into an existing buffer.

This variant avoids allocation when reading multiple chunks.

Return

The number of bytes actually read (may be less than length at EOF)

Parameters

position

Starting byte offset in the source

buffer

Target buffer to read into

offset

Starting offset in the buffer

length

Number of bytes to read